<% @title = "Transfer Gems" %>

<% content_for :aside do %>
  <%= render "rubygems/transfer/summary", current_step: 1 %>
<% end %>

<%= render "rubygems/transfer/progress", current_step: 1 %>

<h2 class="text-h4 mb-10">Select your Organization</h2>

<p class="mb-10">
  Choose which organization you want to transfer your gem to.
</p>

<%= form_with(model: @rubygem_transfer, url: organization_transfer_rubygems_path, method: :post) do |f| %>
  <%= render "rubygems/transfer/error", transfer: @rubygem_transfer if @rubygem_transfer.errors.any? %>
  <%= f.label :organization, t(".organization"), class: 'form__label block text-sm font-medium text-gray-700 dark:text-gray-200 mb-2' %>
  <label class="flex flex-col xl:flex-row items-center rounded-lg border border-neutral-400 dark:border-neutral-600 overflow-hidden">
    <%= f.select(
      :organization,
      options_for_select(@organizations.collect { [it.name, it.handle]}, selected: @rubygem_transfer.organization&.handle),
      { 
        prompt: "select...",
      },
      {
        required: true,
        class: "flex-1 w-full h-11 text-b2 px-4 xl:px-2 bg-white border-none dark:bg-neutral-950 rounded-b-lg xl:rounded-bl-none xl:rounded-r-lg outline-none appearance-none focus:ring-inset focus:ring-1 focus:ring-orange-500"
      }
    ) %>
  </label>

  <div class="flex border-t border-neutral-400 lg:-mx-10 lg:px-10 pt-10 mt-10 justify-between">
    <%= render ButtonComponent.new("Cancel", transfer_rubygems_path, type: :link, color: :neutral, style: :outline, method: :delete) %>
    <%= render ButtonComponent.new("Continue", type: :submit, style: :outline) %>
  </div>
<% end %>
